package com.xian.cloud.resoure;

import org.springframework.cloud.bootstrap.config.PropertySourceLocator;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: xlr
 * @Date: Created in 下午11:48 2018/11/1
 */
@Configuration
public class SourcesLocator implements PropertySourceLocator {

    /**
     * 自定义资源配置信息
     */
    Map<String, String> propertyMap = new HashMap<>();

    @Override
    public PropertySource<?> locate(Environment environment) {
        String[] defaultProfiles = environment.getDefaultProfiles();
        for (String defaultProfile : defaultProfiles) {
            System.out.println(defaultProfile);
        }
        System.out.println(environment);
        return null;
    }

}
